-
-
Notifications
You must be signed in to change notification settings - Fork 395
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
perf: faster tick for snapshot #8427
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Skipped Deployment
|
|
Your org has enabled the Graphite merge queue for merging into masterAdd the label “merge” to the PR and Graphite will automatically add it to the merge queue when it’s ready to merge. You must have a Graphite account and log in to Graphite in order to use the merge queue. Sign up using this link. |
☁️ Nx Cloud ReportCI is running/has finished running commands for commit 300fe2c. As they complete they will appear below. Click to see the status, the terminal output, and the build insights. 📂 See all runs for this CI Pipeline Execution ✅ Successfully ran 1 targetSent with 💌 from NxCloud. |
size-limit report 📦
|
I do think it's much better to add a parameter in this function. |
@fourdim function testNextTick(useRequestIdleCallback, iterations = 1000) {
const nextTick = useRequestIdleCallback
? (callback) => requestIdleCallback(() => callback())
: (callback) => queueMicrotask(() => callback());
return new Promise((resolve) => {
const startTime = performance.now();
let count = 0;
function runIteration() {
if (count < iterations) {
nextTick(() => {
count++;
runIteration();
});
} else {
const endTime = performance.now();
resolve(endTime - startTime);
}
}
runIteration();
});
}
async function runTest() {
console.log('Starting performance test...');
const rICTime = await testNextTick(true);
console.log(`requestIdleCallback: ${rICTime.toFixed(2)}ms`);
const qMTTime = await testNextTick(false);
console.log(`queueMicrotask: ${qMTTime.toFixed(2)}ms`);
const difference = Math.abs(rICTime - qMTTime);
const fasterMethod = rICTime < qMTTime ? 'requestIdleCallback' : 'queueMicrotask';
console.log(`\nDifference: ${difference.toFixed(2)}ms`);
console.log(`${fasterMethod} is faster in this test.`);
}
runTest();
|
We won't jam the UI becuase we have batch import function which reserves the time for UI to response. |
Here is also the code path when pasting very long content, see #7796 |
This tries to optimize #8380